
################################################################################
# Start File: Predictive Validity
################################################################################

rm(list=ls()) # removes all objects 
getwd() # check if working in root file

# Libraries ----
library(tidyverse)
library(dplyr)
library(rstatix)
library(psych)
library(ltm)
library(skimr)
library(lme4) # for rergression model specification
library(emmeans) # for interaction effects
library(ggplot2)
library(ggthemes)
library(stargazer)
library(viridis) # colour blind friendly palette
library(ggExtra) 
library(forcats)
library(hrbrthemes)
library(extrafont)
library(sjPlot)
library(knitr)

# Process data ----
source("2_PredVal_EA_processdata.R") # Predictive Validity Exploratory Analysis
source("3_PredVal_CA_processdata.R") # Predictive Validity Confirmatory Analysis & Meta-analysis data 


# Model specification ----
source("4_PredVal_EA_interactionmodels.R") # Predictive Validity Exploratory Analysis: Models with data frame for heatmap and regression table
source("5_PredVal_CA_interactionmodels.R") # Predictive Validity Confirmatory Analysis: Models with data frame for heatmap and regression table
source("6_PredVal_META_interactionmodels.R") # Predictive Validity Meta Analysis: Models with data frame for heatmap and regression table

# Power analysis ---
source("7_PredVal_power.R") # power analysis for 3-way interaction models

# Contrasts ----
source("8_PredVal_contrast.R") # all contrasts with tables

# Descriptives of sample ----
source("9_PredVal_describe_sample.R") 

# Descriptives of outcomes ----
source("10_PredVal_describe_outcome.R") 

# Reliability of scales used for outcomes ----
source("11_PredVal_alpha.R")

# Heatmaps for Estimated Marginal Means ----
source("12_PredVal_Figure_3_frames.R") # data frames for Figure 3
source("13_PredVal_Figure_3.R") # Figure 3
